package com.lovo.service;

import com.lovo.model.InvoiceDO;
import com.lovo.model.UserDO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class InvoiceService {
    private List invoiceList = new ArrayList();
    @Resource
    private UserService userService;
    public InvoiceService(UserService userService){
        this.userService = userService;
    }
    public List find(){

        return invoiceList;
    }
    public void create(String userId,int amount){
        if(userService.findById(userId) == null){
            return;
        }

        InvoiceDO invoiceDO = new InvoiceDO(userId,amount,"http://www.lovo.com/invoice.pdf");
        invoiceList.add(invoiceDO);

    }
}
